package com.example.rfidserver.consume.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.rfidserver.R;
import com.example.rfidserver.pojo.User;

import java.util.List;

public class IntegralManagerAdapter extends BaseAdapter {

    private List<User> users;
    private Context context;
    public IntegralManagerAdapter(Context context,List<User> user){
        this.users = user;
        this.context = context;
    }
    @Override
    public int getCount() {
        return users.size()==0?0:users.size();
    }
    @Override
    public User getItem(int position) {
        return users.get(position)==null?null:users.get(position);
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.item_list_integral_manager,null);
        final TextView integral_manager_inner_user_id = view.findViewById(R.id.integral_manager_inner_user_id);
        final TextView integral_manager_inner_user_integral = view.findViewById(R.id.integral_manager_inner_user_integral);
        integral_manager_inner_user_id.setText("用户id:"+getItem(position).getId());
        integral_manager_inner_user_integral.setText("积分:"+getItem(position).getIntegral_bill());
        return view;
    }
}
